/**
 * 北京中流科技有限公司 版权所有
 * http://www.chinasoa.com.cn
 */
package cn.com.chinasoa.archive.runtime.util;
/**
 * @author 刘洋(liuyang@chinasoa.com.cn)
 * 2007-8-1下午05:48:54
 */
public class CharUtil {
	
	public static String toChi(String input){
		return iso2gb2312(input);
	}
	public static String transcod (byte[] bytes,String fe,String te){
		try{
			return new String (bytes,te);
		}
		catch (Exception ex){
			return new String(bytes);
		}
	}	
	public static String transcod (String input,String fe,String te){
		if(input==null)return input;
		try{
			byte[] bytes = input.getBytes (fe);
			return new String (bytes,te);
		}
		catch (Exception ex){
			return input;
		}
	}
	public static String transcod (String input,String te){
		try{
			byte[] bytes = input.getBytes ();
			return new String (bytes,te);
		}
		catch (Exception ex){
			return input;
		}
	}	
	public static String iso2to (String input,String te){
		return transcod(input,"iso8859-1",te);
	}
	public static String iso2gb2312 (String input){
		return iso2to(input,"gb2312");
	}
	public static String iso2gbutf8 (String input){
		return iso2to(input,"UTF-8");
	}

}
